/**
 * configs.h
 **/

#ifndef __CONFIGS_H__
#define __CONFIGS_H__

/*###############################################*\
 * configus                                      *
\*###############################################*/
/**
 * WORKING_MODE_PHOTO: in this mode, movie record will stoped, preview still working.
 * WORKING_MODE_MOVIE: in this mode, movie record and preview started.
 * WORKING_MODE_PLAYBACK: in this mode, sensor will stop work.
 **/
enum _CONF_WORKING_MODE {
	CONF_WORKING_MODE_PHOTO,
	CONF_WORKING_MODE_MOVIE,	/* default */
	CONF_WORKING_MODE_PLAYBACK,
	_CONF_WORKING_MODE_MAX
};

/**
 * the photo size, this size scaled from the origin size of capture by software.
 **/
enum _CONF_PHOTO_SIZE {
	CONF_PHOTO_SIZE_2M,		/* default */
	CONF_PHOTO_SIZE_3M,
	CONF_PHOTO_SIZE_5M,
	CONF_PHOTO_SIZE_8M,
	_CONF_PHOTO_SIZE_MAX
};

/**
 * NOTE: movie size for record
 **/
enum _CONF_MOVIE_SIZE {
	CONF_MOVIE_SIZE_1080p,		/* used for normal lens */
	CONF_MOVIE_SIZE_960p,		/* used for normal lens */
	CONF_MOVIE_SIZE_720p,		/* used for normal lens */
	CONF_MOVIE_SIZE_VGA,		/* used for normal lens */
	CONF_MOVIE_SIZE_1520S,		/* 1520 * 1520, used for 360 fisheye lens */
	CONF_MOVIE_SIZE_1080S,		/* 1080 * 1080, used for 360 fisheye lens */
	CONF_MOVIE_SIZE_720S,		/* 720 * 720, used for 360 fisheye lens */
	_CONF_MOVIE_SIZE_MAX
};

/**
 * if CONF_CYCLIC_REC_OFF, the movie will record in one file.
 **/
enum _CONF_CYCLIC_REC {
	CONF_CYCLIC_REC_OFF,
	CONF_CYCLIC_REC_3MIN,		/* default */
	CONF_CYCLIC_REC_5MIN,
	CONF_CYCLIC_REC_10MIN,
	_CONF_CYCLIC_REC_MAX
};

/**
 * NOTE: wdr status
 **/
enum _CONF_WDR_STATE {
	CONF_WDR_ENABLED,
	CONF_WDR_DISABLED,
	_CONF_WDR_MAX
};

/**
 * NOTE: EV value
 **/
enum _CONF_EV_VALUE {
	CONF_EV_P20,
	CONF_EV_P16,
	CONF_EV_P13,
	CONF_EV_P10,
	CONF_EV_P06,
	CONF_EV_P03,
	CONF_EV_00,		/* default */
	CONF_EV_N03,
	CONF_EV_N06,
	CONF_EV_N10,
	CONF_EV_N13,
	CONF_EV_N16,
	CONF_EV_N20,
	_CONF_EV_MAX
};

/**
 * NOTE: audio status while record
 **/
enum _CONF_AUDIO_STATE {
	CONF_AUDIO_ENABLED,
	CONF_AUDIO_DISABLED,
	_CONF_AUDIO_MAX
};

/**
 * NOTE: priview size of RTSP stream
 **/
enum _CONF_PREVIEW_SIZE {
	CONF_PREVIEW_SIZE_720p,		/* used for normal lens */
	CONF_PREVIEW_SIZE_VGA,		/* used for normal lens */
	CONF_PREVIEW_SIZE_QVGA,		/* used for normal lens */
	CONF_PREVIEW_SIZE_800S,		/* 800 * 800, used for 360 fisheye lens */
	CONF_PREVIEW_SIZE_720S,		/* 720 * 720, used for 360 fisheye lens */
	CONF_PREVIEW_SIZE_640S,		/* 640 * 640, used for 360 fisheye lens */
	CONF_PREVIEW_SIZE_480S,		/* 480 * 480, used for 360 fisheye lens */
	CONF_PREVIEW_SIZE_360S,		/* 360 * 360, used for 360 fisheye lens */
	_CONF_PREVIEW_SIZE_MAX
};

/**
 * NOTE: gsensor sensitivity for lock emergency video
 **/
enum _CONF_LOCK_GSENSOR_SENS {
	CONF_LOCK_GSENSOR_OFF,
	CONF_LOCK_GSENSOR_SENS_LOW,
	CONF_LOCK_GSENSOR_SENS_MID,		/* default */
	CONF_LOCK_GSENSOR_SENS_HIGH,
	_CONF_LOCK_GSENSOR_SENS_MAX
};

/**
 * NOTE: gsensor sensitivity for parking monitoring
 **/
enum _CONF_MONITOR_GSENSOR_SENS {
	CONF_MONITOR_GSENSOR_OFF,
	CONF_MONITOR_GSENSOR_SENS_LOW,
	CONF_MONITOR_GSENSOR_SENS_MID,		/* default */
	CONF_MONITOR_GSENSOR_SENS_HIGH,
	_CONF_MONITOR_GSENSOR_SENS_MAX
};

/**
 * NOTE: poweroff time after power supply off
 **/
enum _CONF_AUTO_POWEROFF_TIME {
	CONF_POWEROFF_TIME_0MIN,
	CONF_POWEROFF_TIME_3MIN,	/* default */
	CONF_POWEROFF_TIME_5MIN,
	CONF_POWEROFF_TIME_10MIN,
	_CONF_POWEROFF_TIME_MAX
};

/**
 * NOTE: language
 **/
enum _CONF_LANGUAGE {
	CONF_LANG_EN,			/* default */
	CONF_LANG_FR,
	CONF_LANG_ES,
	CONF_LANG_PO,
	CONF_LANG_DE,
	CONF_LANG_IT,
	CONF_LANG_SC,
	CONF_LANG_TC,
	CONF_LANG_RU,
	CONF_LANG_JP,
	_CONF_LANG_MAX
};

/**
 * NOTE: directory function
 **/
#define DIRECTORY_FUNCITON_NORMAL_VIDEO      0
#define DIRECTORY_FUNCITON_LOCK_VIDEO        1
#define DIRECTORY_FUNCITON_PHOTO             2
#define DIRECTORY_FUNCITON_THUMBNAIL         3
#define DIRECTORY_FUNCITON_PARK_VIDEO        4

#define DIRECTORY_LEFT_CAPACITY_WARNING_ON   1

#define DIRECTORY_CAPACITY_LIMIT_TYPE_PERCENT   1
#define DIRECTORY_CAPACITY_LIMIT_TYPE_ABSOLUTE  2

#define DIRECTORY_FILE_CICLE_DELETE_ON       1

/*###############################################*\
 * structure to save configure                   *
\*###############################################*/

typedef struct _photo_config {
	int photo_size;
} photo_config_t;

typedef struct _movie_config {
	int movie_size;
	int cycle_record;
	int record_bitrate;
} movie_config_t;

typedef struct _live_video_config {
	int preview_size;
	int preview_bitrate;
} live_video_config_t;

typedef struct _gsensor_config {
	int lock_gsensor_sens;
	int monitor_gsensor_sens;
} gsensor_config_t;

typedef struct _g_config {
	volatile photo_config_t photo_conf;
	volatile movie_config_t movie_conf;
	volatile live_video_config_t live_video_conf;
	volatile gsensor_config_t gsensor_conf;
	volatile int wdr_state;
	volatile int ev_value;
	volatile int audio_state;
	char wifi_ssid[32];
	char wifi_pwd[32];
	volatile int auto_poweroff_time;
	volatile int language;
} g_config_t;

/*********************************>>LOAD CONFIG INFO*********************************/
/*wj: load config info for each dir*/
typedef struct _g_directory_config {
	char directory_name[32];
	char directory_path[32];
	int directory_function;
	int directory_capacity_limit_type;
	int directory_capacity_percent;
	int directory_capacity_absolution;
	int directory_file_cicle_delete;
	int directory_delete_priority;
	int directory_left_capacity_warning;
} g_directory_config_t;

/*wj: load config info for sd common*/
typedef struct _g_sdconfig {
	volatile int format_enable;			/*格式化属性*/
	volatile int folder_num;			/*行车专属文件夹数目*/
	volatile int sd_reserved_warning_number;    /*磁盘预留限额/最大录像大小*/
	volatile int lockvideo_reserved_warning_number;/*紧急录像限额/最大紧急录像大小*/
	volatile int photo_reseved_warning_number;  /*照片限额/最大照片大小*/
	volatile int park_reseved_warning_number;   /*停车录像限额/最大停车录像大小*/
	g_directory_config_t *directory;

} g_sdconfig_t;
/**********************************LOAD CONFIG INFO<<********************************/


/********************************>>INIT SDCARD INFO**********************************/
typedef struct _g_sdinfo {
	volatile int format_enable;
	volatile int folder_num;
	volatile int sd_free_space;
	volatile int norvideo_maxsize;
	volatile int lockvideo_maxsize;
	volatile int photo_maxsize;
	volatile int park_maxsize;
	volatile int sd_reserved_warning_size;
	volatile int lockvideo_reserved_warning_size;
	volatile int photo_reserved_warning_size;
	volatile int park_reserved_warning_size;
    volatile char rootpath[32];	
	g_directory_config_t *directory;
} g_sdinfo_t;
/**********************************INIT SDCARD INFO>>*******************************/



/**
 * must defined in MODULE_LM
 **/
extern g_config_t *gconf;
extern g_sdconfig_t *gsdconf;
extern g_sdinfo_t *gsdinfo;
//extern g_directory_config_ *gdirconf;

#endif /* __CONFIGS_H__ */
